package com.cskaoyan.service.vx.wangdi;

import com.cskaoyan.bean.Address;
import com.cskaoyan.bean.Brand;
import com.cskaoyan.bean.BrandExample;
import com.cskaoyan.bean.vx.wangdi.BrandBean;
import com.cskaoyan.bo.vx.wangdi.DetailBo;
import com.cskaoyan.bo.vx.wangdi.RegionListBo;
import com.cskaoyan.bo.vx.wangdi.VxAddressBo;
import com.cskaoyan.mapper.BrandMapper;
import com.cskaoyan.vo.BrandVO;
import com.cskaoyan.vo.vx.wangdi.VxBrandVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.aspectj.weaver.ast.Var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VxBrandServiceImpl implements VxBrandService {

    @Autowired
    BrandMapper brandMapper;
    @Override
    public VxBrandVo list(Integer page, Integer size) {
        PageHelper.startPage(page,size);
        BrandExample brandExample = new BrandExample();
        List<BrandBean> brands = brandMapper.select1();
        PageInfo<BrandBean> pageInfo = new PageInfo<>(brands);
        int total = pageInfo.getPages();
        VxBrandVo vxBrandVo= new VxBrandVo();
        vxBrandVo.setTotalPages(total);
        vxBrandVo.setBrandList(brands);
        return vxBrandVo;
    }

    @Override
    public Brand detail(Integer id) {
        Brand brand = brandMapper.selectByPrimaryKey(id);
        return brand;
    }
}
